#! /bin/bash
export LANG=zh_CN.UTF-8
HIVE_HOME=/usr/bin/hive


${HIVE_HOME} -S -e "
DROP TABLE IF EXISTS edu_online_dwb.dwb_relationship_detail;
CREATE TABLE edu_online_dwb.dwb_relationship_detail(
    -- fact_customer_relationship
    relation_id                 INT    COMMENT '意向id',
    create_time                 STRING COMMENT '创建时间',
    origin_type                 STRING COMMENT '线上线下, NETSERVICE or PRESIGNUP 表示线上',
    origin_channel              STRING COMMENT '来源渠道',
    -- fact_customer_clue
    clue_state                  STRING COMMENT '新老学员，VALID_NEW_CLUES',
    -- dim_customer
    area                        STRING COMMENT '地区',
    -- dim_itcast_subject
    subject_id                  INT    COMMENT '学科id',
    subject_name                STRING COMMENT '学科名称',
    -- dim_itcast_school
    school_id                   INT    COMMENT '校区id',
    school_name                 STRING COMMENT '校区名称',
    -- dim_scrm_department
    department_id               INT    COMMENT '部门id',
    department_name             STRING COMMENT '部门名称'

)COMMENT '意向明细宽表'
PARTITIONED BY (dt STRING)
ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'
STORED AS TEXTFILE ;



---线索明细宽表建表语句
--    1、建库 库名 edu_online_dwb
--    2、建表 表名 dwb_clue_detail
DROP TABLE IF EXISTS edu_online_dwb.dwb_clue_detail;
CREATE TABLE edu_online_dwb.dwb_clue_detail(
    -- fact_customer_clue
    clue_id                     INT COMMENT '线索id',
    create_time                 STRING COMMENT '创建时间',
    clue_state                  STRING COMMENT '新老学员，VALID_NEW_CLUES',
    origin_type                 STRING COMMENT '线上线下, NETSERVICE or PRESIGNUP 表示线上',
    -- dim_customer_appeal
    appeal_status               INT COMMENT '申诉状态，0:待稽核 1:无效 2：有效'

)COMMENT '意向明细宽表'
PARTITIONED BY (dt STRING)
ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'
STORED AS TEXTFILE ;
"